<?php
/* @var $this SiteController */
/* @var $model ContactForm */
/* @var $form CActiveForm */

$this->pageTitle=Yii::app()->name . ' - Contato A R Produtos';
$this->breadcrumbs=array(
	'Contato',
);
?>

<h1><?=Yii::t('app','Contact Us')?></h1>

<?php if(Yii::app()->user->hasFlash('contact')): ?>

<div class="flash-success">
	<?php echo Yii::app()->user->getFlash('contact'); ?>
</div>

<?php else: ?>


R. Cristiânia, 434 - Jardim São Luís
São Paulo, 05834-090, Brasil ‎

<div id='map' streetnumber='434' streetname='RUA+Cristiânia+434'
        cityname='SÃO+PAULO' statecode='BR' zipcode='05834-090'
        zoom=18 width=980 height=400>
</div>
<p style=" margin-top: 20px; font-weight: bold">
Para dúvidas ou sugestões preencha o formulário abaixo
</p>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'contact-form',
	'enableClientValidation'=>true,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
)); ?>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'Nome'); ?>
		<?php echo $form->textField($model,'name'); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'E-mail'); ?>
		<?php echo $form->textField($model,'email'); ?>
		<?php echo $form->error($model,'email'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'Mensagem'); ?>
		<?php echo $form->textArea($model,'body',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'Mensagem'); ?>
	</div>

	

	<div class="row buttons">
		<?php echo CHtml::submitButton('Enviar'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->

<?php endif; ?>

<script>
$.fn.googlemap = function(){
    // author: Christian Salazar <christiansalazarh@gmail.com>
    var src='';
    $(this).each(function(){
    var z = $(this);
    var address = jQuery.trim(z.attr('streetnumber'))
        +'+'+jQuery.trim(z.attr('streetname'))
        +'+'+jQuery.trim(z.attr('cityname'))
        +'+'+jQuery.trim(z.attr('statecode'))
        +'+'+jQuery.trim(z.attr('zipcode'))
    ;
    src="https://maps.google.com/maps?"
        +"client=safari"
        +"&q="+address
        +"&oe=UTF-8&ie=UTF8&hq="
        +"&hnear="+address
        +"&gl=us"
        +"&z="+z.attr('zoom')
        +"&output=embed";
        z.html("<iframe src='"+src+"' width="+z.attr('width')+" height="
        +z.attr('height')+"></iframe>");
    });
    return src;
}
</script>
<script>$('#map').googlemap();</script>